import { Model } from 'mongoose';
import { ITaskMetadata } from '../models/types';
import { BaseRepository } from './BaseRepository';

export class TaskMetadataRepository extends BaseRepository<ITaskMetadata> {
  private taskMetadataModel: Model<ITaskMetadata>;

  constructor(model: Model<ITaskMetadata>) {
    super(model);
    this.taskMetadataModel = model;
  }

  async findBySessionAndType(sessionId: string, metadataType: string): Promise<ITaskMetadata[]> {
    return this.taskMetadataModel.find({ sessionId, metadataType }).lean().exec();
  }
}
